package com.googlecode.garbagecan.simonstudy.myspring;

import org.javasimon.SimonManager;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {

	public static void main(String[] args) throws Exception {
		String[] configs = new String[] {
				"/com/googlecode/garbagecan/simonstudy/myspring/mymonitoring.xml", 
				"/com/googlecode/garbagecan/simonstudy/myspring/spring.xml"};
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext(configs);
		
		for (int i = 0; i < 3; i++) {
			UserService userService = (UserService) applicationContext.getBean("userService");
			userService.test1();
			userService.test2();
			userService.test3();
		}
		
		// Class level
		System.out.println(SimonManager.getSimon("com.googlecode.garbagecan.simonstudy.myspring.UserServiceFactory.getUserService"));
		
		// Method level
		System.out.println(SimonManager.getSimon("com.googlecode.garbagecan.simonstudy.myspring.UserService.test1"));
		System.out.println(SimonManager.getSimon("com.googlecode.garbagecan.simonstudy.myspring.UserService.test2"));
		System.out.println(SimonManager.getSimon("com.googlecode.garbagecan.simonstudy.myspring.UserService.test3"));
	}
}
